﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace DHJ.Cost.Migrations
{
    public partial class Added_QcCard : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "QcCards",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QcCards", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "KitItem",
                columns: table => new
                {
                    Id = table.Column<string>(nullable: false),
                    QcCardId = table.Column<string>(nullable: true),
                    Sequence = table.Column<int>(nullable: false),
                    Certificate = table.Column<string>(nullable: true),
                    DrawingNumber = table.Column<string>(nullable: true),
                    Name = table.Column<string>(nullable: true),
                    ItemAmount = table.Column<int>(nullable: false),
                    DetailAmount = table.Column<int>(nullable: false),
                    StockedOutAmount = table.Column<int>(nullable: false),
                    ItemSort = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_KitItem", x => x.Id);
                    table.ForeignKey(
                        name: "FK_KitItem_QcCards_QcCardId",
                        column: x => x.QcCardId,
                        principalTable: "QcCards",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_KitItem_QcCardId",
                table: "KitItem",
                column: "QcCardId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "KitItem");

            migrationBuilder.DropTable(
                name: "QcCards");
        }
    }
}
